<?php
/**
 * @desc:
 * wsxc - ConfigImpl.php
 * @author: quanjianyu
 * @email: 164174421@qq.com
 * @dateTime：2021/4/7 4:24
 */

namespace wsxc\config\impl;


use wsxc\config\IConfig;

class ConfigImpl implements IConfig {

    private string $userAgent;
    private string $cookie;
    private string $xRequestedWith;
    private string $baseApiUrl;

    /**
     * ConfigImpl constructor.
     */
    public function __construct() { }


    function getUserAgent(): string {
        return $this->userAgent;
    }

    /**
     * @param string $userAgent
     */
    public function setUserAgent(string $userAgent): void {
        $this->userAgent = $userAgent;
    }

    /**
     * @return string
     */
    public function getCookie(): string {
        return $this->cookie;
    }

    /**
     * @param string $cookie
     */
    public function setCookie(string $cookie): void {
        $this->cookie = $cookie;
    }

    /**
     * @return string
     */
    public function getXRequestedWith(): string {
        return $this->xRequestedWith;
    }

    /**
     * @param string $xRequestedWith
     */
    public function setXRequestedWith(string $xRequestedWith): void {
        $this->xRequestedWith = $xRequestedWith;
    }

    /**
     * @param string $baseApiUrl
     */
    public function setBaseApiUrl(string $baseApiUrl): void {
        $this->baseApiUrl = $baseApiUrl;
    }

    /**
     * @return string
     */
    public function getBaseApiUrl(): string {
        return $this->baseApiUrl;
    }

    function toArray(): array {
        $arr = [
            'headers'  => [
                'User-Agent'       => $this->getUserAgent(),
                'Cookie'           => $this->getCookie(),
                'X-Requested-With' => $this->getXRequestedWith(),
            ],
            'base_uri' => $this->getBaseApiUrl()
        ];
        return $arr;
    }
}